import {getFund,fundPerformance} from '../../http/jijing/jijing.js'
export default ({
	namespaced:true,
	state:{
		Fund:[],
		days:[],
		newData:[],
	},
	mutations:{
		Fund(state,a){
			state.Fund = a
		},
		days(state,a){
			state.days = a
		},
		newData(state,a){
			state.newData = a
		}
	},
	actions:{
		async getFunds(context){
			const data = await getFund()
			context.commit('Fund',data.data)
			
		},
		async fundPerformances(context,a){
			const data =await fundPerformance(a)
			console.log(data.data)
			const days =	data.data.map((item)=>{
					return	item.time
			})
			const newData = data.data.map((item)=>{
				return item.acc_net_value
			})
			context.commit('days',days)
			context.commit('newData',newData)
		}
	}

})